/*
 * SerialPort.h
 *
 *  Created on: May 12, 2011
 *      Author: stud
 */

#ifndef SERIALPORT_H_
#define SERIALPORT_H_


using namespace std;

#include <stdio.h>
#include <unistd.h>  /* UNIX standard function definitions */
#include <fcntl.h>   /* File control definitions */
#include <errno.h>   /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

class SerialPort{

private:
	int fd;
	int baudRate;
	char * device;

public:

	SerialPort(char * device,int baudRate);
	~SerialPort();

	int serialPortInit();
	int readBlock(unsigned char * buff, int len);
	int writeBlock(unsigned char * buff,int len);
	int close();

	int getBaudRate();
	char * getDeviceName();
	int getFd();


};

#endif /* SERIALPORT_H_ */
